// Copyright @ ChenChao


#include "AnimInstances/Hero/WarriorHeroAnimInstance.h"

#include "Characters/WarriorHeroCharacter.h"

void UWarriorHeroAnimInstance::NativeInitializeAnimation()
{
	Super::NativeInitializeAnimation();

	if (OwningCharacter)
	{
		//所属英雄角色赋值
		OwningHeroCharacter = Cast<AWarriorHeroCharacter>(OwningCharacter); 
	}
}

void UWarriorHeroAnimInstance::NativeThreadSafeUpdateAnimation(float DeltaSeconds)
{
	Super::NativeThreadSafeUpdateAnimation(DeltaSeconds);

	//角色运动，就重置时间
	if (bHasAcceleration)
	{
		bShouldEnterRelaxState = false;
		IdleElapsedTime = 0.f;
	}
	else
	{
		IdleElapsedTime += DeltaSeconds;  //累计时间
		if (IdleElapsedTime >= EnterRelaxStateThreshold)
		{
			bShouldEnterRelaxState = true;
		}
	}
	
}
